package kubernetes

type Pods struct {
	Kind       string `json:"kind"`
	APIVersion string `json:"apiVersion"`
	Items      []Item `json:"items"`
}

type Item struct {
	Metadata Metadata `json:"metadata"`
}

type Metadata struct {
	Name            string            `json:"name"` // pod的name
	Namespace       string            `json:"namespace"`
	Labels          map[string]string `json:"labels"`
	OwnerReferences []OwnerReference  `json:"ownerReferences"`
}

// 以下结构体是通过/pods接口获取的json映射

type PodsInfoMetrics struct {
	PodKind       string    `json:"kind"`
	PodAPIVersion string    `json:"apiVersion"`
	PodItems      []PodItem `json:"items"`
}

type PodItem struct {
	Metadata Metadata `json:"metadata"`
	Status   Status   `json:"status"`
}

type Status struct {
	Phase             string            `json:"phase"`
	Conditions        []Conditions      `json:"conditions"`
	ContainerStatuses []ContainerStatus `json:"containerStatuses"`
}

type Conditions struct {
	Type               string `json:"type"`
	Status             string `json:"status"`
	LastProbeTime      string `json:"lastProbeTime"`
	LastTransitionTime string `json:"lastTransitionTime"`
}

type ContainerStatus struct {
	Name         string `json:"name"` // 容器的name
	Ready        bool   `json:"ready"`
	RestartCount int    `json:"restartCount"`
	//Image        string `json:"image"`
	Started bool `json:"started"`
}

type OwnerReference struct {
	ApiVersion         string `json:"apiVersion"`
	Kind               string `json:"kind"`
	Name               string `json:"name"`
	Uid                string `json:"uid"`
	Controller         bool   `json:"controller"`
	BlockOwnerDeletion bool   `json:"blockOwnerDeletion"`
}

type PodServiceKindInfo struct {
	ServiceName           string `json:"serviceName"`
	PodOwnerReferenceKind string `json:"podOwnerReferenceKind"`
}
